import type { CardDetail, CardListData, CardListParams,CardParams, CarListData, CarListParams } from "@/types/card";
import { request } from "@/utils/reuqest";

export const getCardListAPI = (params: CardListParams) => {
  return request<CardListData>("/parking/card/list", "GET", params);
};

export const createCardAPI = (params: Partial<CardParams>)=>{
  return request("/parking/card",'POST',params)
}

export const getCardDetailAPI = (id: string) => {
  return request<CardDetail>(`/parking/card/detail/${id}`)
}

//编辑月卡
export const updateCardAPI = (data: Partial<CardDetail>) => {
  return request('/parking/card/edit', 'PUT', data)
}
//删除月卡
//批量删除时 id用逗号隔开 通过join方法拼接字符串
export const delCardAPI = (ids: number[]) => {
  return request(`parking/card/${ids.join(',')}`,'DELETE')
}
//获取规则列表
export const getRuleListAPI = (params: CarListParams) => {
  return request<CarListData>('parking/rule/list', 'GET', params)
}